import { setSelect } from '@/services/question-select';
import { message } from 'antd';

export function submit(param: { id: number; question_answer?: number }) {
  return (opt) => {
    if (!param.question_answer && param.question_answer !== 0) {
      return message.error('请点击ABCD选择该题答案');
    }

    setSelect({ ...opt, ...param }).then((res) => {
      switch (res.code) {
        case 200:
          message.success(res.data);
          break;
        default:
          break;
      }
    });
    return true;
  };
}
